﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ad="clr-namespace:AvalonDock"
    xmlns:adRes="clr-namespace:AvalonDock.Properties;assembly=AvalonDock"    
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/AvalonDock;component/Resources/Brushes.xaml"/>
        <ResourceDictionary Source="/AvalonDock;component/Resources/Common.xaml"/>
        <ResourceDictionary Source="/AvalonDock;component/Resources/ManagedContentStyle.xaml"/>
    </ResourceDictionary.MergedDictionaries>


    <ContextMenu
		     x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.DockablePane}}"
		     >
        <MenuItem
			Command="ad:DockableContentCommands.FloatingWindow"  />
        <MenuItem
			Command="ad:ManagedContentCommands.Show" />
        <MenuItem
			Command="ad:DockableContentCommands.ShowAsDocument" />
        <MenuItem
			Command="ad:DockableContentCommands.ToggleAutoHide" />
        <MenuItem
			Command="ad:ManagedContentCommands.Hide" 
                  Visibility="{Binding Path=IsCloseable, Converter={x:Static ad:Converters.BoolToVisibilityConverter}}" />
    </ContextMenu>


	<!--DockableContentTabItemStyle-->
    <Style x:Key="DockableContentTabItemStyle" TargetType="{x:Type ad:DockableContent}">
		<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
		<Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ad:DockableContent}">
                    <Grid SnapsToDevicePixels="True">
                        <Border 
						    x:Name="PART_DragArea" 
						    BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" 
						    BorderThickness="1,0,1,1" 
                            Margin="0,2,0,0"
                            CornerRadius="0,0,3,3"
                            Background="{StaticResource ManagedContentTabItemNormalBackground}"                             
                            >
                            <Border x:Name="tabItemIntBorder" 
							Margin="0,1,0,2" 
							BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}">
									<Grid Margin="4,0,4,0">
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="Auto"/>
											<ColumnDefinition Width="*"/>
										</Grid.ColumnDefinitions>
                                    <ad:ImageEx x:Name="Icon" Width="16" Source="{TemplateBinding Icon}"/>
										<TextBlock 
											x:Name="tabItemTitle"
											Grid.Column="1"
											TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"
											Text="{TemplateBinding Title}" 
											Margin="2,0,0,0" VerticalAlignment="Center"
											Foreground="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
									</Grid>
                            </Border>
                        </Border>
                        <Border x:Name="HighlightBorder"
                                        Height="3"
                                        VerticalAlignment="Bottom"
                                        BorderThickness="0,0,0,0"
                                        CornerRadius ="0,0,3,3"
                                        BorderBrush="#FFE68B2C"
                                        Background="{StaticResource ManagedContentTabItemSelectedBorderBackround}"
                                        Visibility="Hidden"
                                        />
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="Selector.IsSelected"
								 Value="true">
                            <Setter Property="BorderThickness"
									Value="0" TargetName="tabItemIntBorder"/>
                            <Setter Property="BorderThickness"
									Value="1,0,1,0" TargetName="PART_DragArea"/>
                            <Setter Property="Background"
									Value="#FFFCFCFE" TargetName="PART_DragArea"/>
                            <Setter Property="CornerRadius"
									Value="0,0,3,3" TargetName="PART_DragArea"/>
                            <Setter Property="Visibility"
									Value="Visible" TargetName="HighlightBorder"/>
                            <Setter Property="Foreground"
									Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TargetName="tabItemTitle"/>
                            <Setter Property="Margin"
                                    Value="0,3,0,2" TargetName="tabItemIntBorder"/>
                            <Setter Property="Margin"
                                    Value="0,1,0,0" TargetName="PART_DragArea"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver"
								 Value="true">
                            <Setter Property="Visibility"
									Value="Visible" TargetName="HighlightBorder"/>
                        </Trigger>
                        <Trigger Property="Icon"
                     Value="{x:Null}">
                            <Setter TargetName="Icon"
                        Property="Visibility"
                        Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

	<!--DockablePane-->
    <Style x:Key="{x:Type ad:DockablePane}" TargetType="{x:Type ad:DockablePane}">
        <Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/>
		<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
		<Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ad:DockablePane}"><!--Background="{TemplateBinding Background}"-->
                    <Border  
                        Focusable="False"
                        Background="{TemplateBinding Background}">
                        <Grid FocusManager.FocusedElement="{Binding ElementName=PART_SelectedContent}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Border x:Name="PART_Header" 
							    Grid.Row="0" Focusable="False" 
							    Background="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DockablePaneTitleBackground}}}"
							    BorderThickness="1,1,1,0" 
							    BorderBrush="DarkGray"
                                Height="18">
                                <DockPanel LastChildFill="True">
                                    <Button DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePaneCommands.Close" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.IsCloseable, Converter={x:Static ad:Converters.BoolToVisibilityConverter}}" ToolTip="{x:Static adRes:Resources.DockablePaneCommands_Close}">
										<!--<ad:AlignedImage>-->
                                        <ad:ImageEx Source="Images\PinClose.png" Width="13" />
										<!--</ad:AlignedImage>-->
                                    </Button>
                                    <Button x:Name="btnPinAutoHide" DockPanel.Dock="Right" Width="15" Height="15"  Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePaneCommands.ToggleAutoHide" ToolTip="{x:Static adRes:Resources.DockablePaneCommands_ToggleAutoHide}">
										<!--<ad:AlignedImage>-->
                                        <ad:ImageEx Source="Images\PinAutoHide.png" Width="13" />
										<!--</ad:AlignedImage>-->
									</Button>
                                    <Border x:Name="PART_ShowContextMenuButton"  DockPanel.Dock="Right" Width="15" Height="15"  Style="{StaticResource PaneHeaderContextMenuCommandStyle}"  ToolTip="{x:Static adRes:Resources.DockablePane_ShowOptionsMenu}">
										<!--<ad:AlignedImage>-->
                                        <ad:ImageEx Source="Images\PinMenu.png" Width="13" />
										<!--</ad:AlignedImage>-->
                                    </Border>
                                    <TextBlock 
									    Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Title}" 
									    x:Name="paneTitle"
									    Grid.Row="0" 
									    Margin="2,0,0,0" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"
                                        VerticalAlignment="Center"
									    Foreground="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DockablePaneTitleForeground}}}"/>
							    </DockPanel>
                            </Border>
                            <Border Grid.Row="1" 
							    BorderThickness="1,0,1,1" 
							    BorderBrush="DarkGray"
                                Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Background}">
                                <ContentPresenter 
                                    x:Name="PART_SelectedContent"
                                    Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}"
								    KeyboardNavigation.TabNavigation="Local"
								    KeyboardNavigation.DirectionalNavigation="Contained"
								    KeyboardNavigation.TabIndex="1"
                                    />
                            </Border>
                            <Border x:Name="PART_Tabs"
                                    Grid.Row="2" 
								    Margin ="0,2,0,0" 
                                    Height ="25" 
								    BorderThickness="0,1,0,0" 
								    BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" 
								    >
                            </Border>
                            <ad:DockableTabPanel
                                    Grid.Row="2" 
                                    Height ="24" 
                                    KeyboardNavigation.TabIndex="2"								
                                    IsItemsHost="True" 
                                    x:Name="paneTabsPanel" 
                                    Margin="0,0,0,2"
                                    TabItemStyle="{StaticResource DockableContentTabItemStyle}"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <!--<Trigger Property="IsKeyboardFocusWithin"  Value="True">
                            <Setter Property="Background" Value="{StaticResource DockablePaneTitleBackground}" TargetName="PART_Header"/>
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionTextBrushKey}}" TargetName="paneTitle"/>
                        </Trigger>-->
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.IsActiveContent}" Value="True" >
                            <Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DockablePaneTitleBackgroundSelected}}}" TargetName="PART_Header"/>
                            <Setter Property="Foreground" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DockablePaneTitleForegroundSelected}}}" TargetName="paneTitle"/>
                        </DataTrigger>
                        <!--<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsOptionsMenuOpened}" Value="True" >
                            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" TargetName="PART_Header"/>
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionTextBrushKey}}" TargetName="paneTitle"/>
                        </DataTrigger>-->
                        <Trigger Property ="ShowHeader" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Header"/>
                        </Trigger>
                        <Trigger Property ="ShowTabs" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Tabs"/>
                        </Trigger>
                        <Trigger Property ="HasSingleItem" Value="True">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Tabs"/>
                            <Setter Property="Visibility" Value="Collapsed" TargetName="paneTabsPanel"/>
                        </Trigger>

                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},  Path=SelectedItem.State}" Value="AutoHide">
                            <Setter Property="LayoutTransform" TargetName="btnPinAutoHide">
                                <Setter.Value>
                                    <RotateTransform Angle="90"/>
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>


                    </ControlTemplate.Triggers>


                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- FloatingDockablePane -->
    <Style x:Key="{x:Type ad:FloatingDockablePane}" TargetType="{x:Type ad:FloatingDockablePane}" BasedOn="{StaticResource {x:Type ad:DockablePane}}">

    </Style>
</ResourceDictionary>